package com.uum.admin.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;

import java.util.List;

import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.uum.common.core.base.BaseEntity;
import com.uum.common.core.valid.InsertGroup;
import com.uum.common.core.valid.UpdateGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Null;

/**
 * <p>
 *
 * </p>
 *
 * @author Tsang_yc
 * @since 2022-01-06
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
public class SysUser extends BaseEntity {

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @NotEmpty(message = "用户名不能为空")
    @ApiModelProperty(value = "用户名")
    private String username;

    @NotEmpty(message = "昵称不能为空")
    @ApiModelProperty(value = "昵称")
    private String nickname;

    @NotEmpty(message = "密码不能为空",groups = {InsertGroup.class})
    @Null(message = "密码不能修改",groups = {UpdateGroup.class})
    @ApiModelProperty(value = "密码")
    private String password;

    @ApiModelProperty(value = "逻辑删除 0未删除 1已删除")
    @TableLogic
    private Integer isDeleted;

    @ApiModelProperty(value = "是否禁用 0未禁用 1已禁用")
    private Integer isDisabled;

    @ApiModelProperty(value = "账号状态 0未激活 1已激活")
    private Integer status;

    @ApiModelProperty(value = "用户头像")
    private String avatar;

    @ApiModelProperty(value = "创建方式")
    private String createMethod;

    @ApiModelProperty(value = "创建者Id")
    private Long createUserId;

    /**
     * 用户的角色Ids
     */
    @TableField(exist=false)
    private List<Long> roleIds;

}
